Skip to content

fix(web): a new worktree's row names its real base, not the checkout's branch - #1025

Merged
badcuban merged 1 commit into
mainfrom
fix/worktree-base-label
Nov 20, 2026
Merged

badcuban merged 1 commit into
mainfrom
fix/worktree-base-label

Conversation

@badcuban

Copy link
Copy Markdown
Collaborator

In New worktree mode, the row under the message box ("Runs in a new worktree from X", or the "From X" chip) showed the checkout's current branch while the "New worktrees from" setting's branch was still loading. On a busy repository that list can take seconds. The worktree then started from the setting's branch, which can be a different one, so the row named the wrong branch.

The row now never guesses the checkout's branch. It shows, in order:

  1. a branch the user picked
  2. the setting's branch, once found
  3. while the lookup runs, the branch the setting will give when that's knowable without the list (predictNewWorktreeBaseBranch in @threadlines/shared/git):
    • "current": the checkout's branch
    • "named": that name
    • "default": the checkout's branch, but only when git status says it is the default
  4. otherwise words: "the default branch" or "the current branch", or "…" before the computer's settings arrive
  5. "pick a branch" when nothing fits, including when the lookup failed (a failed lookup now counts as no base instead of still loading)

useNewWorktreeBaseBranch now returns { branch, expected, from }. resolveBranchToolbarValue takes the expected base instead of falling back to the checkout's branch.

Tests. New predictNewWorktreeBaseBranch tests. The slow-branch-list browser test now checks that the row says "From default branch" rather than the checkout's branch. Two existing expectations changed on purpose:

  • resolveBranchToolbarValue's "defaults new-worktree mode to current git ref" test encoded the bug. It now checks the opposite.
  • The waiting-send picker test expected "From main" while a slow "develop" lookup ran. The row now names "develop".

Web unit (3,305), shared git (43), ChatView browser (312) and source control browser (56) tests pass, along with fmt, lint and typecheck.

Review. Reviewed by GPT-6.2-Astra. Fixed: a missing named branch reappearing after the lookup answered; a failed lookup looking like loading; "the default branch" shown before the setting arrived. Left as before: if the setting changes while a new thread is open, the saved base stays until the new lookup lands (this predates this change). The chip's empty text stays "Select ref".

…s branch

While the "New worktrees from" setting's branch was still loading (the
branch list can take seconds), the row under the message box showed the
checkout's current branch. The worktree then started from the setting's
branch, which can be a different one.

The row now shows, in order: a picked branch; the setting's branch once
found; while the lookup runs, the branch the setting will give when that's
knowable without the list (predictNewWorktreeBaseBranch: the checkout's
branch for "current", the name for "named", the checkout's branch for
"default" only when git status says it is the default); otherwise "the
default branch" / "the current branch" in words, or "…" before the
computer's settings arrive; and "pick a branch" when nothing fits,
including when the lookup failed (which now counts as no base rather than
loading).

resolveBranchToolbarValue no longer falls back to the checkout's branch for
a new worktree; its test that expected that fallback now expects the
opposite.
@vercel

vercel Bot commented Nov 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
threadlines Skipped Skipped Nov 20, 2026 7:15pm UTC

Request Review

@badcuban
badcuban added this pull request to the merge queue Nov 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 20, 2026
@badcuban
badcuban added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit 9afc540 Nov 20, 2026
23 checks passed
@badcuban
badcuban deleted the fix/worktree-base-label branch November 20, 2026 19:36

This branch was previously deployed

1 inactive deployment
Preview — fae91836 Deployed Nov 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant